package com.yunchao.bank.business.data.mapper

import com.yunchao.bank.business.data.model.BusinessIssueInfoApiModel
import com.yunchao.bank.business.domain.enum.BusinessType
import com.yunchao.bank.business.domain.model.BusinessInfoModel

internal fun BusinessIssueInfoApiModel.toDomainModel(taskId: Int) = BusinessInfoModel(
    code = code,
    businessName = BusinessType.getTaskNameByCode(code).orEmpty(),
    businessInfoList = busiInfoList?.map { it.toDomainModel() } ?: emptyList(),
    packInfoList = packInfoList?.map { it.toDomainModel() } ?: emptyList(),
    selectInfoList = stackInfoList?.map { it.toDomainModel() }
        ?: teamList?.map { it.toDomainModel() } ?: emptyList(),
    taskId = taskId
)